"""
[difference.py]
Devuelve la diferencia entre dos matrices/imagenes dadas, 
aplicandoles anteriormente el efecto Smooth
"""

from opencv.cv import *
from opencv.highgui import *
from opencv import *



def difference(img1, img2):
    
    aux1 = cvCreateMat(img1.rows, img1.cols, img1.type)
    aux2 = cvCreateMat(img1.rows, img1.cols, img1.type)
    res = cvCreateMat(img1.rows, img1.cols, img1.type)
    
    cvSmooth(img1,aux1, CV_GAUSSIAN,5,5)
    cvSmooth(img2,aux2, CV_GAUSSIAN,5,5)
    
    cvAbsDiff(aux1, aux2, res)
    return res

